<?php
function _echo($data, $date_type = 'json', $callback = '', $JSON_UNESCAPED_UNICODE = FALSE) {
	$result = '';
	switch ($date_type) {
		case 'jsonp' :
			if ($JSON_UNESCAPED_UNICODE == JSON_UNESCAPED_UNICODE) $result = $callback.'('.json_encode($data).');';
			$result = $callback.'('.json_encode($data).');';
			break;
			
		case 'msgpack' :
			$result = msgpack_pack($data);
			break;
		case 'json' :
		default :
			if ($JSON_UNESCAPED_UNICODE == JSON_UNESCAPED_UNICODE) $result = json_encode($data,JSON_UNESCAPED_UNICODE);
			else $result = json_encode($data);
			break;
	}
	echo $result;
}